//
// Created by Administrator on 2024/5/16.
// 递归正序倒序打印数组
//


#include <iostream>
using namespace std;

void printListForward(int *p, int n)
{
    if (n<1)
        return;
    printListForward(p, n-1);
    cout<<p[n];
}

void printListBackward(int *p, int n)
{
    if (n<1)
        return;
    cout<<p[n];
    printListForward(p, n-1);
}

int main()
{
    int l[]{0,1,2,3,4,5,6,7,8,9};
    printListForward(l,sizeof(l)/sizeof (int)-1);
    cout<<endl;
    printListBackward(l,sizeof(l)/sizeof (int)-1);
    return 0;
}